num = int(input("Enter an integer: "))   #设置num为输入的一个整数
factorial = 1   #阶乘默认从1开始
if num < 0:   #当num<0时没有阶乘
   print("Factorial does not exist for negative numbers")
elif num == 0:   #当num=0时阶乘为0
   print("The factorial of 0 is ", factorial)
else:   #正整数有阶乘
   for i in range(1,num + 1):
       factorial = factorial*i
   print("The factorial of",num," is ",factorial)   #打印出num的阶乘